package sum.DatasetBean;

import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class MarriageDatasetBean implements Writable {
    private float marriages;//结婚登记数
    private float divorces;//离婚登记数

    public MarriageDatasetBean(){

    }

    public MarriageDatasetBean(long marriages, long divorces){
        this.marriages = marriages;
        this.divorces = divorces;
    }

    public void set(float marriages,float divorces){
        this.marriages = marriages;
        this.divorces = divorces;
    }

    public float getMarriages() {
        return marriages;
    }

    public void setMarriages(float marriages) {
        this.marriages = marriages;
    }

    public float getDivorces() {
        return divorces;
    }

    public void setDivorces(float divorces) {
        this.divorces = divorces;
    }

    @Override
    public String toString(){
        return marriages + "\t" + divorces;
    }

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeFloat(marriages);
        dataOutput.writeFloat(divorces);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        this.marriages = dataInput.readFloat();
        this.divorces = dataInput.readFloat();
    }
}
